home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
misc
/
mf-db.zip
/
VBSAMPLE\BCARDREF.FRM
< prev
next >
Wrap
Text File
|
1993-05-10
|
4KB
|
133 lines
VERSION 2.00
Begin Form bcardref
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "Reference Table"
Height = 3270
Left = 1365
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2895
ScaleWidth = 4860
Top = 2775
Width = 4950
Begin CommandButton Command3
Caption = "&Delete"
Height = 435
Left = 3840
TabIndex = 3
Top = 1080
Width = 915
End
Begin CommandButton Command2
Caption = "&New"
Height = 435
Left = 3840
TabIndex = 2
Top = 600
Width = 915
End
Begin CommandButton Command1
Caption = "&Edit"
Height = 435
Left = 3840
TabIndex = 1
Top = 120
Width = 915
End
Begin ListBox List1
FontBold = 0 'False
FontItalic = 0 'False
FontName = "Courier New"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 2430
Left = 60
TabIndex = 0
Top = 120
Width = 3675
End
End
Option Explicit
Sub Command1_Click ()
Dim s$, ref As tReference, lRecFound&, iCode%
'Which item is selected:
If list1.ListIndex = -1 Then
MsgBox "Select an item to edit"
Else
s = list1.List(list1.ListIndex)
' Now, we have the selected string:
' PARSE it to get the 'seek key'
ref.ref = Val(Left$(s, 2))
ref.refsub = Val(Mid$(s, 3, 2))
lRecFound = mfSeekO(ref, iCode, TaskHndl, refDBHndl, 0)
' We SHOULD get an exact match
If iCode = MFSEEK_EXACT_MATCH Then
passl = lRecFound
bcardRED.Show ASMODAL
load_refs list1
Else
MsgBox "Wierd -- That record wasn't in the database?"
End If
End If
End Sub
Sub Command2_Click ()
Dim ref As tReference
' We HAVE to set a global variable to pass data
' between forms
ref.name = ""
ref.ref = 0
ref.refsub = 1
passl = mfAppendData(ref.name, TaskHndl, refDBHndl)
junki = mfWrite(passl, ref, TaskHndl, refDBHndl, MFRW_ALL)
bcardRED.Show ASMODAL
load_refs list1
End Sub
' Same basic code as an EDIT
Sub Command3_Click ()
Dim s$, ref As tReference, lRecFound&, iCode%
'Which item is selected:
If list1.ListIndex = -1 Then
MsgBox "Select an item to edit"
Else
s = list1.List(list1.ListIndex)
' Now, we have the selected string:
' PARSE it to get the 'seek key'
ref.ref = Val(Left$(s, 2))
ref.refsub = Val(Mid$(s, 3, 2))
lRecFound = mfSeekO(ref, iCode, TaskHndl, refDBHndl, 0)
' We SHOULD get an exact match
If iCode = MFSEEK_EXACT_MATCH Then
junki = mfDelete(lRecFound, TaskHndl, refDBHndl)
load_refs list1
Else
MsgBox "Wierd -- That record wasn't in the database?"
End If
End If
End Sub
Sub Form_Load ()
Dim lCurRec As Long, ref As tReference
' load list with data
' (Located in bCards.bas)
load_refs list1
End Sub